﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using TC.ShortTour.Common.Controls;

namespace Test
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            Task.Run(() =>
            {
                var p = new Program();
                p.Init();
            });

            Console.ReadKey();
        }

        private void Init()
        {
            GetGuid guid = InputGuid;
            for (int i = 0; i < 9999; i++)
            #region
            {
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
                guid.BeginInvoke(++i, null, null);
            }
            #endregion

        }

        static List<string> _guidList = new List<string>();

        private void InputGuid(int id)
        {
            //string guid = Guid.NewGuid().ToString();
            //if (_guidList.Contains(guid))
            //{
            //    Console.WriteLine(guid);
            //}
            //lock (_guidList)
            //{
            //    _guidList.Add(guid);
            //}

            //if (_guidList.Count == 999999900)
            //{
            //    Console.WriteLine(_guidList.Count.ToString());
            //    Console.WriteLine("最后一个执行完毕");
            //}
            var str = HttpHelper.GetXmlByUrl("http://www.chenjinjian.com/", 10, "UTF-8", false);

            Console.WriteLine(str + " " + id);


        }


        private delegate void GetGuid(int id);
    }
}
